﻿using System;
using System.Web.WebPages;

namespace Mysoft.Platform.Component.Extensions
{
	public static class HelperResultExtention
	{
		public static HelperResult RenderExistedSection(this WebPageBase page, string sectionName, Func<object, HelperResult> defaultContent)
		{
			if (page.IsSectionDefined(sectionName))
			{
				return page.RenderSection(sectionName);
			}
			else
			{
				return defaultContent(null);
			}
		}
	}
}